new Vue({
	el:'#app',
	data:{
		 Case_law:{
            caseId:'',
            clientId:{
                clientId:''
            },
            oppositeId:{
                clientId:''
            },
            caseTypeid:{
                caseTypeid:''
            },
            thirdParty:'',
            objectOfAction:'',
            locusStandi:'',
            agencyMoney:'',
            blendMoney:'',
            courtId:{
                courtId:''
            },
            stateSessionDate:'',
            sessionDate:'',
            causeOfAction:'',
            causeDetails:'',
            mainLawyer:{
                empId:''
            },
            version:'',
            comment:'',
            submitId:{
                userId:''
            }
        },
        Case_audit: {
          caseid:{
          	caseId:''
          },
          auditid:{
          	remark:'',
          	submitid:{
          	  userId:'',
          	  userName:''
          	}
          }, 
          remissionMoney:'',
          submitTime:''
        }
	},
	created(){
		this.init();
	},
	methods:{
		init(){ //得到案件id
			var caseid = localStorage.getItem("caseid");
			//根据案号查询基本信息
			this.$http.post("http://localhost:8080/law/queryByid",
                {"caseid":caseid},{emulateJSON:true}).then(result=>{
				var msg = eval("("+result.body+")");
				this.Case_law = msg.data;
			});
			//设置案件id
            this.Case_audit.caseid.caseId = caseid;
			//设置申请人为当前登录用户
			this.Case_audit.auditid.submitid.userId = $.cookie("redisId");
			this.Case_audit.auditid.submitid.userName = $.cookie("redisName");
		},
		onSubmit() {
	       var data = JSON.stringify(this.Case_audit);
	       this.$http.post("http://localhost:8080/remission/start",
               {"data":data},{emulateJSON:true}).then(result=>{
               var msg = eval("("+result.body+")");
               if(msg.code == 0){
                   this.$message.success(msg.data);
               }
               window.location.href="Case_init.html";
           })
	    }
	}
});

